<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <input type="text" class="rowCount" value="">行数</input>
    <input type="text" class="cellCount" value="">列数</input>
    <input type="button" value="添加表格" onClick="CreateTable">
    <!--<input type="button" value="添加行" class="rowcount">-->
    <div id="createtable"></div>
    <div id="createrow"></div>

    <script src="node_modules/jquery/dist/jquery.js"></script>
    <script type="text/javascript">
        var rowCount = $(".rowCount").text();
        var cellCount = $("cellCount").text();
        // console.log(rowCount);

        function CreateTable(rowCount, cellCount) {
            console.log(rowCount);

            var table = $("<table border=\"1\">");
            table.appendTo($("#createtable"));
            for (var i = 0; i < rowCount; i++) {
                var tr = $("<tr></tr>");
                tr.appendTo(table);
                for (var j = 0; j < cellCount; j++) {
                    var td = $("<td>" + i * j + "</td>");
                    td.appendTo(tr);
                }
            }
            // trend.appendTo(table);
            $("#createtable").append("</table>");
        }
    </script>
</body>

</html>